<template>
  <div class="container">
    <el-dialog title="题目审核" :visible="showAudit" width="30%" @close="close">
      <el-form :model="form" ref="form" class="demo-ruleForm">
        <el-form-item prop="check">
          <el-radio v-model="form.chkState" :label="1">通过</el-radio>
          <el-radio v-model="form.chkState" :label="2">拒绝</el-radio>
        </el-form-item>
        <el-form-item prop="text">
          <el-input
            type="textarea"
            v-model="form.chkRemarks"
            placeholder="请输入审核意见"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button type="primary" @click="sub"
          >确认</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  data () {
    return {
      showAudit: false,
      id: '',
      form: {
        chkState: 1,
        chkRemarks: ''
      }
    }
  },
  methods: {
    open (row) {
      this.id = row.id
      this.showAudit = true
    },
    close () {
      this.form.chkState = 1
      this.form.chkRemarks = ''
      this.showAudit = false
    },
    async sub () {
      if (this.form.chkRemarks) {
        try {
          await choiceCheck({ id: this.id, chkState: this.form.chkState, chkRemarks: this.form.chkRemarks })
          this.$message.sucess('操作成功')
        } catch (error) {

        }
        this.close()
        this.$emit('init')
      } else {
        this.$message.warning('请输入审核的意见')
      }
    }
  }
}
</script>

<style scoped lang="less" ></style>
